package com.ruicar.afs.cloud.afscase.approvetask.service.impl;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruicar.afs.cloud.afscase.approvetask.entity.WorkProcessScheduleInfo;
import com.ruicar.afs.cloud.afscase.approvetask.mapper.WorkProcessScheduleInfoMapper;
import com.ruicar.afs.cloud.afscase.approvetask.service.WorkProcessScheduleInfoService;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>Description: </p>
 *
 * @author ZC.GUO
 * @version 1.0
 * @date create on 2020-05-17 11:34
 */
@Service
@AllArgsConstructor
@Data
@Slf4j
public class WorkProcessScheduleInfoServiceImpl extends ServiceImpl<WorkProcessScheduleInfoMapper, WorkProcessScheduleInfo> implements WorkProcessScheduleInfoService {
    /**
     * 通过申请编号和流程编号查询流程对象
     *
     * @param applyNo
     * @param stageNo
     * @return
     * @author yk.Li
     */
    @Override
    public WorkProcessScheduleInfo findByApplyAndStageNo(String applyNo, String stageNo) {
        return this.getOne(Wrappers.<WorkProcessScheduleInfo>query().lambda()
                .eq(StringUtils.isNotBlank(applyNo), WorkProcessScheduleInfo::getApplyNo, applyNo)
                .eq(StringUtils.isNotBlank(stageNo), WorkProcessScheduleInfo::getStageNo, stageNo));
    }
    @Override
    public List<String> queryFlowInstanceIdsByApplyNo(String applyNo) {
        return this.baseMapper.queryFlowInstanceIdsByApplyNo(applyNo);
    }
}
